I know how to get the object number associated with a given object, but how do I get the object if I have its Object Number? For example, I have an Object Number of 3.1.1.0-1 and want to get the text of the object associated with that number. How, if possible, can I do this?
Chris Cote chrscote - Fri Jun 30 15:09:38 EDT 2017 |
Re: Retrieving text at specific object number You make a skip where you index the objects with their object number:
Skip sk = createString()
Object o; for o in entire mod do put(sk, number o, o);
string s = "3.1.1.0-1";
if (find(sk, s, o)) {
print "Found Object " (o."Absolute Number") "\n"
}
Regards, Mathias |
Re: Retrieving text at specific object number Mathias Mamsch - Fri Jun 30 16:42:08 EDT 2017 You make a skip where you index the objects with their object number:
Skip sk = createString()
Object o; for o in entire mod do put(sk, number o, o);
string s = "3.1.1.0-1";
if (find(sk, s, o)) {
print "Found Object " (o."Absolute Number") "\n"
}
Regards, Mathias I apologize. I understand what you are doing with this code Mathias. However, unlike other DXL code I've written for dxl script, this code needs to be used within a template which means that the code would need to be run once for each object. How, or where, would I write the first 2 lines of code above so that the skip is created just once?
Chris |
Re: Retrieving text at specific object number chrscote - Mon Jul 03 10:55:52 EDT 2017 I apologize. I understand what you are doing with this code Mathias. However, unlike other DXL code I've written for dxl script, this code needs to be used within a template which means that the code would need to be run once for each object. How, or where, would I write the first 2 lines of code above so that the skip is created just once?
Chris By template you mean "Attribute DXL" / Layout DXL ? It is a common problem for Layout DXL / Attribute DXL to display data that needs to be calculated expensively. You can throw all kinds of hacks at it, but first you should evaluate if the calculation you need to perform is really that expensive, that you cannot do it from attribute DXL (which will make the calculation once and then use the values) which leads to a short waiting time. In this case you would simply do something like this:
for o in entire m do {
if (number o == mySearchNumber) { obj.attrDXLName = "..."; break; }
}
And see if you can get away with the performance. If not you need to do caching. For very expensive operations I wrote about a GUI backed layout DXL cache in the forum, you can search for it - but whatever method you are choosing it will involve some 'hacks'. Regards, Mathias |
Re: Retrieving text at specific object number Mathias Mamsch - Mon Jul 03 12:06:19 EDT 2017 By template you mean "Attribute DXL" / Layout DXL ? It is a common problem for Layout DXL / Attribute DXL to display data that needs to be calculated expensively. You can throw all kinds of hacks at it, but first you should evaluate if the calculation you need to perform is really that expensive, that you cannot do it from attribute DXL (which will make the calculation once and then use the values) which leads to a short waiting time. In this case you would simply do something like this:
for o in entire m do {
if (number o == mySearchNumber) { obj.attrDXLName = "..."; break; }
}
And see if you can get away with the performance. If not you need to do caching. For very expensive operations I wrote about a GUI backed layout DXL cache in the forum, you can search for it - but whatever method you are choosing it will involve some 'hacks'. Regards, Mathias By template, I'm talking about JavaScript code used within a .dta file (using RPE) which my company uses to create specialized documents for different programs' modules. For example, the design team has its set of requirements while the development or testing team may have another set of requirements. (I came into this project after the template file had been used for a few years, so there's very little chance of me changing the way things are done.) Anyway, this template file contains conditional statements to display certain items depending on their attributes (both system and custom) and variables and their values. So, if an object within a document fits the condition, it gets displayed in the document in some pre-defined way.
Chris |
Re: Retrieving text at specific object number chrscote - Tue Jul 04 10:33:53 EDT 2017 By template, I'm talking about JavaScript code used within a .dta file (using RPE) which my company uses to create specialized documents for different programs' modules. For example, the design team has its set of requirements while the development or testing team may have another set of requirements. (I came into this project after the template file had been used for a few years, so there's very little chance of me changing the way things are done.) Anyway, this template file contains conditional statements to display certain items depending on their attributes (both system and custom) and variables and their values. So, if an object within a document fits the condition, it gets displayed in the document in some pre-defined way.
Chris In this case I would not worry about performance and I would use a simple search for the object number inside the DXL. I can hardly imagine that this will be the defining factor of the RPE export speed. Regards, Mathias |